package formin.powerbar.gui;

import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Color;
import javax.swing.BoxLayout;
import formin.powerbar.core.*;


public class PlugPanel extends JPanel {
	
	private PowerBarCore coreRef = null;
	
	private int plugNumber;
	private String plugVisualString;
	private String plugType;

	private JPanel plugNamePanel;
	private JPanel plugOnOffPanel;
	private JPanel plugEditPanel;

	private JLabel plugNumberLabel;
	private JLabel plugVisualOnOffLabel;
	private JLabel plugTypeLabel;
	
	//PlugPanel constructor
	public PlugPanel(int numb, PowerBarCore core){
		
		this.coreRef = core;
		plugType = "";
		plugVisualString = "";
		plugNumber = numb;
		
		plugNamePanel = new JPanel();
		plugOnOffPanel = new JPanel();
		plugEditPanel = new JPanel();
		

		plugNumberLabel = new JLabel();
		plugTypeLabel = new JLabel();
		
		
		plugVisualOnOffLabel = new JLabel();
		plugNumberLabel.setText(String.valueOf(plugNumber));
		
		
		this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
		this.add(plugNamePanel);
		this.add(plugOnOffPanel);
		this.add(plugEditPanel);
		
		plugNamePanel.setLayout(new BoxLayout(plugNamePanel, BoxLayout.Y_AXIS));
		plugOnOffPanel.setLayout(new BoxLayout(plugOnOffPanel, BoxLayout.Y_AXIS));
		plugEditPanel.setLayout(new BoxLayout(plugEditPanel,BoxLayout.Y_AXIS));
		
		plugVisualOnOffLabel.setFont(plugVisualOnOffLabel.getFont().deriveFont((float)20.0));
		
		plugNamePanel.add(plugNumberLabel);
		plugNamePanel.add(plugTypeLabel);
		plugOnOffPanel.add(plugVisualOnOffLabel);
		plugOnOffPanel.setSize(200, 35);
		plugOnOffPanel.setBackground(new Color(23242));


	}
	
	public void resetFocus(){
		plugOnOffPanel.setBackground(new Color(23242));
	}
	public void setFocus(){
		plugOnOffPanel.setBackground(new Color(94324));
	}
	
	public int getPlugNumber(){
		return plugNumber;
	}
	public void setPlugType(String type){
		plugType = type;
		plugTypeLabel.setText(type);
	}
	public void setOnOffString( String str){
		plugVisualString = str;
		plugVisualOnOffLabel.setText(plugVisualString);
	}


} 
